package com.amentretenimiento;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class LoginMyXMLHandler extends DefaultHandler {

	Boolean currentElement = false;
	String currentValue = null;
	public static LoginSitesList loginsitesList = null;

	public static LoginSitesList getSitesList() {
		return loginsitesList;
	}

	public static void setSitesList(LoginSitesList sitesList) {
		LoginMyXMLHandler.loginsitesList = sitesList;
	}

	/** Called when tag starts ( ex:- <name>AndroidPeople</name> 
	 * -- <name> )*/
	@Override
	public void startElement(String uri, String localName, String qName,
			Attributes attributes) throws SAXException {

		currentElement = true;

		if (localName.equals("RESULTS"))
		{
			/** Start */ 
			loginsitesList = new LoginSitesList();
		} else if (localName.equals("TOTAL")) {
			/** Get attribute value */
			String attr = attributes.getValue("rows");
			loginsitesList.setrows(attr);
			}

	}

	/** Called when tag closing ( ex:- <name>AndroidPeople</name> 
	 * -- </name> )*/
	@Override
	public void endElement(String uri, String localName, String qName)
			throws SAXException {

		currentElement = false;

		/** set value */ 
		if (localName.equalsIgnoreCase("idCia"))				//Login
			loginsitesList.setidCia(currentValue);
		else if (localName.equalsIgnoreCase("IdAgente"))		//Login
			loginsitesList.setidAgente(currentValue);
		else if (localName.equalsIgnoreCase("Nombre"))			//Login
			loginsitesList.setnombre(currentValue);
		else if (localName.equalsIgnoreCase("NIP"))				//Login
			loginsitesList.setNIP(currentValue);
		else if (localName.equalsIgnoreCase("Password"))		//Login
			loginsitesList.setpassword(currentValue);
		else if (localName.equalsIgnoreCase("NumCelular"))		//Login
			loginsitesList.setNumCelular(currentValue);
		else if (localName.equalsIgnoreCase("IdCiaSupervisor"))		//Login
			loginsitesList.setIdCiaSupervisor(currentValue);
		else if (localName.equalsIgnoreCase("IdAgenteSupervisor"))		//Login
			loginsitesList.setIdAgenteSupervisor(currentValue);
		else if (localName.equalsIgnoreCase("EsSupervisor"))		//Login
			loginsitesList.setEsSupervisor(currentValue);
		
		else if (localName.equalsIgnoreCase("IdProducto"))		//Inventario
			loginsitesList.setIdProducto(currentValue);
		
		else if (localName.equalsIgnoreCase("IdTipoQueja"))		//Quejas
			loginsitesList.setIdTipoQueja(currentValue);
		
		
		else if (localName.equalsIgnoreCase("TOTAL"))
			loginsitesList.setTOTAL(currentValue);
		
		else if (localName.equalsIgnoreCase("totalvisitada"))
			loginsitesList.setTotalVisitada(currentValue);
		
		else if (localName.equalsIgnoreCase("IdRuta"))
			loginsitesList.setIdRuta(currentValue);
		else if (localName.equalsIgnoreCase("idcliente"))
			loginsitesList.setidCliente(currentValue);
		else if (localName.equalsIgnoreCase("numsucursal"))
			loginsitesList.setnumSucursal(currentValue);
		else if (localName.equalsIgnoreCase("IdCliente"))
			loginsitesList.setidCliente(currentValue);
		else if (localName.equalsIgnoreCase("NumSucursal"))
			loginsitesList.setnumSucursal(currentValue);
		else if (localName.equalsIgnoreCase("Nombre"))
			loginsitesList.setnombre(currentValue);
		else if (localName.equalsIgnoreCase("Calle"))
			loginsitesList.setcalle(currentValue);
		else if (localName.equalsIgnoreCase("Numero"))
			loginsitesList.setnumero(currentValue);
		else if (localName.equalsIgnoreCase("Colonia"))
			loginsitesList.setcolonia(currentValue);
		else if (localName.equalsIgnoreCase("CP"))
			loginsitesList.setCP(currentValue);
		else if (localName.equalsIgnoreCase("IdEstado"))
			loginsitesList.setidEstado(currentValue);
		else if (localName.equalsIgnoreCase("IdMunicipio"))
			loginsitesList.setidMunicipio(currentValue);
		else if (localName.equalsIgnoreCase("TelDomicilio"))
			loginsitesList.settelDomicilio(currentValue);
		else if (localName.equalsIgnoreCase("Cadena"))
			loginsitesList.setCadena(currentValue);
		else if (localName.equalsIgnoreCase("DiaDesJefePiso"))
			loginsitesList.setDiaDesJefePiso(currentValue);
		else if (localName.equalsIgnoreCase("JefePiso"))
			loginsitesList.setJefePiso(currentValue);
		else if (localName.equalsIgnoreCase("Auxiliar"))
			loginsitesList.setAuxiliar(currentValue);
		else if (localName.equalsIgnoreCase("TipoMueble"))
			loginsitesList.setTipoMueble(currentValue);
		else if (localName.equalsIgnoreCase("Linea"))
			loginsitesList.setLinea(currentValue);
		else if (localName.equalsIgnoreCase("MueblesDisney"))
			loginsitesList.setMueblesDisney(currentValue);
		else if (localName.equalsIgnoreCase("NumProveedor"))
			loginsitesList.setNumProveedor(currentValue);
		else if (localName.equalsIgnoreCase("Gerente"))
			loginsitesList.setGerente(currentValue);
		else if (localName.equalsIgnoreCase("NumCadena"))
			loginsitesList.setNumCadena(currentValue);
		else if (localName.equalsIgnoreCase("IdDelegacionMpo"))
			loginsitesList.setidDelegacion(currentValue);
		
		else if (localName.equalsIgnoreCase("IdCiaCompet"))
			loginsitesList.setIdCiaCompet(currentValue);
		
		
		else if (localName.equalsIgnoreCase("Descripcion"))
			loginsitesList.setdescripcion(currentValue);
		else if (localName.equalsIgnoreCase("DescFormato"))
			loginsitesList.setDescFormato(currentValue);
		else if (localName.equalsIgnoreCase("IdTipoPrecio"))
			loginsitesList.setIdTipoPrecio(currentValue);
		else if (localName.equalsIgnoreCase("DescTipoPrecio"))
			loginsitesList.setDescTipoPrecio(currentValue);
		else if (localName.equalsIgnoreCase("idMueble"))
			loginsitesList.setidMueble(currentValue);
		else if (localName.equalsIgnoreCase("DescMueble"))
			loginsitesList.setDescMueble(currentValue);
		
		else if (localName.equalsIgnoreCase("idExhibicion"))
			loginsitesList.setidExhibicion(currentValue);
		
		else if (localName.equalsIgnoreCase("nombrexhibicion"))
			loginsitesList.setnombrexhibicion(currentValue);
		
		else if (localName.equalsIgnoreCase("descexhibicion"))
			loginsitesList.setdescexhibicion(currentValue);
		
		else if (localName.equalsIgnoreCase("IdFormato"))
			loginsitesList.setIdFormato(currentValue);
		
		else if (localName.equalsIgnoreCase("compania"))
			loginsitesList.setnomCompania(currentValue);
		
		else if (localName.equalsIgnoreCase("idproducto"))
			loginsitesList.setidproducto(currentValue);
		
		else if (localName.equalsIgnoreCase("cantidad"))
			loginsitesList.setcantidad(currentValue);
		
		else if (localName.equalsIgnoreCase("precio"))
			loginsitesList.setprecio(currentValue);
		
		else if (localName.equalsIgnoreCase("cadena"))
			loginsitesList.setCadena(currentValue);
		
		else if (localName.equalsIgnoreCase("IdProdCompet"))
			loginsitesList.setIdProdCompet(currentValue);
		
		else if (localName.equalsIgnoreCase("idcliente"))
			loginsitesList.setidClienteNuevo(currentValue);
		
		else if (localName.equalsIgnoreCase("nombre"))
			loginsitesList.setnombreClienteNuevo(currentValue);
		
		else if (localName.equalsIgnoreCase("producto"))
			loginsitesList.setproducto(currentValue);
		
		
		else if (localName.equalsIgnoreCase("CantInicial"))
			loginsitesList.setcantInicial(currentValue);
		
		else if (localName.equalsIgnoreCase("CantRecib"))
			loginsitesList.setcantRecib(currentValue);
		
		else if (localName.equalsIgnoreCase("idarea"))
			loginsitesList.setidarea(currentValue);
		
		
	}

	/** Called to get tag characters ( ex:- <name>AndroidPeople</name> 
	 * -- to get AndroidPeople Character ) */
	@Override
	public void characters(char[] ch, int start, int length)
			throws SAXException {

		if (currentElement) {
			currentValue = new String(ch, start, length);
			currentElement = false;
		}

	}

}
